﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:ig="http://schemas.infragistics.com/xaml"
	xmlns:OMANE_Modules_TauxGarantis_ViewModels="clr-namespace:OMANE.Modules.TauxGarantis.ViewModels"
    xmlns:OMANE_Modules_TauxGarantis_Views="clr-namespace:OMANE.Modules.TauxGarantis.Views"
    xmlns:OMANE_ui="clr-namespace:OMANE.Common.UI.Theme;assembly=OMANE.Common.UI.Theme" 
    xmlns:omaneui="clr-namespace:OMANE.Common.UI;assembly=OMANE.Common.UI" 
	xmlns:igCA="http://infragistics.com/Chart"  
    xmlns:igEditors="http://infragistics.com/Editors" xmlns:System="clr-namespace:System;assembly=mscorlib"  
    mc:Ignorable="d"
	x:Class="Views.ViewScenarioCentralModel2"
	x:Name="UserControl"
	d:DesignWidth="844" d:DesignHeight="781.25">
    <UserControl.Resources>
    	<GridLength x:Key="LeftGridLength">0.595*</GridLength>
    	<GridLength x:Key="RightGridLength">0.405*</GridLength>
    	<Thickness x:Key="ResultatItemMargin">0,0</Thickness>
    	<Thickness x:Key="InfoTextMargin">20,0,0,0</Thickness>
    	<Thickness x:Key="InfoValueMargin">0</Thickness>
    	<Style x:Key="GaugeStyle" TargetType="{x:Type ig:XamRadialGauge}">
    		<Setter Property="Background">
    			<Setter.Value>
    				<RadialGradientBrush>
    					<GradientStop Color="#FFF7F7F7" Offset="1"/>
    					<GradientStop Color="#FFE5E8EB" Offset="0"/>
    				</RadialGradientBrush>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="BorderBrush">
    			<Setter.Value>
    				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    					<GradientStop Color="#FFFEFEFE"/>
    					<GradientStop Color="#FFBCC3CB" Offset="1"/>
    				</LinearGradientBrush>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ig:XamRadialGauge}">
    					<Grid UseLayoutRounding="False">
    						<Grid.ColumnDefinitions>
    							<ColumnDefinition Width="85*"/>
    							<ColumnDefinition Width="30*"/>
    							<ColumnDefinition Width="85*"/>
    						</Grid.ColumnDefinitions>
    						<Grid.RowDefinitions>
    							<RowDefinition Height="85*"/>
    							<RowDefinition Height="30*"/>
    							<RowDefinition Height="85*"/>
    						</Grid.RowDefinitions>
    						<Ellipse x:Name="background" Grid.ColumnSpan="3" Fill="{TemplateBinding Background}" HorizontalAlignment="Stretch" Height="Auto" Grid.RowSpan="3" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="10" VerticalAlignment="Stretch" Width="Auto" Visibility="Collapsed"/>
    						<Ellipse x:Name="OuterBorder" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Height="Auto" Grid.RowSpan="3" Stroke="#FFBBC3CB" StrokeThickness="1" VerticalAlignment="Stretch" Width="Auto" Visibility="Collapsed"/>
    						<Ellipse x:Name="InnerBorder" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Height="Auto" Margin="10" Grid.RowSpan="3" StrokeThickness="1" VerticalAlignment="Stretch" Width="Auto" Visibility="Collapsed">
    							<Ellipse.Stroke>
    								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    									<GradientStop Color="#FFA3AEB9"/>
    									<GradientStop Color="#FFE4E7EA" Offset="1"/>
    								</LinearGradientBrush>
    							</Ellipse.Stroke>
    						</Ellipse>
    						<ContentPresenter x:Name="RootElement" Grid.ColumnSpan="3" Grid.RowSpan="3"/>
    						<Ellipse x:Name="Anchor" Grid.Column="1" Grid.Row="1" Stroke="#FFBBC3CB" StrokeThickness="2">
    							<Ellipse.Fill>
    								<RadialGradientBrush GradientOrigin="0.739,0.102">
    									<RadialGradientBrush.RelativeTransform>
    										<TransformGroup>
    											<ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="0.856" ScaleX="0.856"/>
    											<SkewTransform CenterY="0.5" CenterX="0.5"/>
    											<RotateTransform CenterY="0.5" CenterX="0.5"/>
    											<TranslateTransform X="0.049" Y="-0.051"/>
    										</TransformGroup>
    									</RadialGradientBrush.RelativeTransform>
    									<GradientStop Color="#FFF9F9FA" Offset="0.008999999612569809"/>
    									<GradientStop Color="#FFCED3D8" Offset="1"/>
    								</RadialGradientBrush>
    							</Ellipse.Fill>
    						</Ellipse>
    					</Grid>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<CollectionViewSource x:Key="CollViewSegmentsRetenus" Source="{Binding SegmentsRetenus}">
    		<CollectionViewSource.GroupDescriptions>
    			<PropertyGroupDescription PropertyName="Value.chOutil.Format.typeAff.Name"/>
    		</CollectionViewSource.GroupDescriptions>
    	</CollectionViewSource>
    </UserControl.Resources>
    <UserControl.DataContext>
    	<OMANE_Modules_TauxGarantis_ViewModels:ViewModelScenarioCentralModel2/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
        	<RowDefinition Height="0.5*"/>
        	<RowDefinition Height="0.5*"/>
        	<RowDefinition/>
        	<RowDefinition Height="Auto"/>
        	<RowDefinition Height="Auto"/>
        	<RowDefinition Height="Auto"/>

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
        	<ColumnDefinition/>
        	<ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <GroupBox Style="{DynamicResource OMANE_GpeBox}" Grid.Row="0" Header="Taux Garanti" >
            <Grid>
                <DataGrid IsReadOnly="True" ItemsSource="{Binding CommissionContractanteSegmente}" />
                
                <!--<Grid VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
                        <ColumnDefinition Width="{DynamicResource RightGridLength}"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Text="Commission contractante :" 
                                VerticalAlignment="Center"
                                Margin="{DynamicResource InfoTextMargin}" />
                    <OMANE_ui:NumericEditor
                              Value="{Binding CommissionContractante}"
                              Width="130"
                              HorizontalAlignment="Left" 
                              Grid.Column="1" 
                              Style="{StaticResource PercentageEditor}" MaxValue="1">
                      
                    </OMANE_ui:NumericEditor>
                </Grid>-->
            </Grid>
        </GroupBox>
        <GroupBox Style="{DynamicResource OMANE_GpeBox}" Grid.Column="1" Grid.RowSpan="3" Header="Niveau de mutualisation" >
            <Grid >
                
                <ListView 
                    Grid.Row="1" 
                    x:Name="Retenue" 
                    Margin="10"
                    ItemsSource="{Binding Source={StaticResource CollViewSegmentsRetenus}}">
                    <ListView.GroupStyle>
                    	<GroupStyle ContainerStyle="{StaticResource ListViewOMANE_GroupItemStyle}" />
                    </ListView.GroupStyle>
                    <ListView.View>
                        <GridView>
                            <GridView.ColumnHeaderContainerStyle>
                                <Style>
                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                </Style>
                            </GridView.ColumnHeaderContainerStyle>
                        	<GridViewColumn Header="A" Width="400">
                        		<GridViewColumn.CellTemplate>
                        			<DataTemplate>
                        				<StackPanel Orientation="Horizontal">
                        					<Image Margin="0,0,5,0" Source="{Binding Value.chOutil.Format.typeAff.Name, Converter={StaticResource TypeNameToIconConverter}}"/>
                        					<TextBlock FontWeight="Regular" Text="{Binding Key}"/>
                        				</StackPanel>
                        			</DataTemplate>
                        		</GridViewColumn.CellTemplate>
                        	</GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
                
            </Grid>
        </GroupBox>
        <GroupBox Style="{DynamicResource OMANE_GpeBox}" Grid.Row="1" Grid.RowSpan="5" Header="Resultats" >
        	<Grid  Margin="0,20,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
        		<Grid VerticalAlignment="Center" Margin="{DynamicResource ResultatItemMargin}">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
        				<ColumnDefinition Width="{DynamicResource RightGridLength}"/>
        			</Grid.ColumnDefinitions>
        			<TextBlock   Text="Nombre de générations à empiler" Margin="{DynamicResource InfoTextMargin}" VerticalAlignment="Center" />
                    <OMANE_ui:NumericEditor Grid.Column="1" Style="{StaticResource PercentageEditor}" SpinIncrement="1" Format="0 génération(s)" Value="{Binding Path=NombreAnneesProjection}"  >
        				<OMANE_ui:NumericEditor.ValueConstraint>
        					<igEditors:ValueConstraint ValidateAsType="Integer32" MinInclusive="1"/>
        				</OMANE_ui:NumericEditor.ValueConstraint>
        			</OMANE_ui:NumericEditor>
        		</Grid>
        		<Grid Grid.Row="1" VerticalAlignment="Center" Margin="{DynamicResource ResultatItemMargin}">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
        				<ColumnDefinition Width="{DynamicResource RightGridLength}"/>
        			</Grid.ColumnDefinitions>
        			<Grid.RowDefinitions>
        				<RowDefinition />
        				<RowDefinition />
        			</Grid.RowDefinitions>
        			<TextBlock  Text="Nombre de prets X assurés de la 1ere génération" Margin="{DynamicResource InfoTextMargin}" VerticalAlignment="Center" TextWrapping="Wrap" />
        			<!--  <TextBlock   xml:lang="fr-FR" Text="{Binding Path=ResultatsScenarioCentral.PPurePf, StringFormat=\{0:N4\}}" 
                                Grid.Column="1" 
                                Margin="{DynamicResource InfoValueMargin}"/> !-->
                    <TextBlock xml:lang="fr-FR" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="1" >
                        <TextBlock.Text>
                            <Binding Path="NbPretsAssuGen1" StringFormat="#,#" />
                        </TextBlock.Text>
                    </TextBlock>
                    <OMANE_ui:NumericEditor x:Name="numericEditor" Grid.Column="1" Style="{StaticResource PercentageEditor}" SpinIncrement="1" Format="#,#" Value="{Binding Path=NbPretsAssuGen1}">
                        <OMANE_ui:NumericEditor.Visibility>
                            <Binding Path="IsNbPretsAssuGen1ValeurPerso">
                                <Binding.Converter>
                                    <BooleanToVisibilityConverter />
                                </Binding.Converter>
                            </Binding>
                        </OMANE_ui:NumericEditor.Visibility>
                        <OMANE_ui:NumericEditor.ValueConstraint>
        					<igEditors:ValueConstraint ValidateAsType="Integer32"/>
        				</OMANE_ui:NumericEditor.ValueConstraint>        				
        			</OMANE_ui:NumericEditor>
                    
        			<StackPanel Grid.Row="1" Margin="40,10,0,0">
                        <RadioButton Margin="0,0,0,5" Content="Saisie Personnalisée" IsChecked="{Binding IsNbPretsAssuGen1ValeurPerso, Mode=TwoWay}" />
        				<RadioButton Margin="0,5,0,0" Content="Utiliser la base en entrée"/>
        			</StackPanel>
        		</Grid>
                <Grid Grid.Row="2" VerticalAlignment="Center" Margin="{DynamicResource ResultatItemMargin}">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
        				<ColumnDefinition Width="{DynamicResource RightGridLength}"/>
        			</Grid.ColumnDefinitions>
        			<TextBlock  Text="Croissance de la population assurée" Margin="{DynamicResource InfoTextMargin}" VerticalAlignment="Center" />
        			<!-- <TextBlock   xml:lang="fr-FR" Text="{Binding ResultatsScenarioCentral.PTechPf,  StringFormat=\{0:N4\}}" Grid.Column="1" Margin="{DynamicResource InfoValueMargin}"/> !-->

                    <OMANE_ui:NumericEditor Grid.Column="1" Style="{StaticResource PercentageEditor}" Value="{Binding Path=CroissPopAssuNb}"  />

        		</Grid>
                <Grid Grid.Row="3" VerticalAlignment="Center" Margin="{DynamicResource ResultatItemMargin}">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
        				<ColumnDefinition Width="{DynamicResource RightGridLength}"/>
        			</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
        				<RowDefinition />
        				<RowDefinition />
        			</Grid.RowDefinitions>
        			<TextBlock  Text="Somme des capitaux initiaux de la 1ere génération" Margin="{DynamicResource InfoTextMargin}" VerticalAlignment="Center" TextWrapping="Wrap" />
        			<!--  <TextBlock   xml:lang="fr-FR" Text="{Binding ResultatsScenarioCentral.SP,  StringFormat=\{0:P\}}" Grid.Column="1" Margin="{DynamicResource InfoValueMargin}"/> !-->

                    <TextBlock xml:lang="fr-FR" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="1" >
                        <TextBlock.Text>
                            <Binding Path="CapitauxInitiaux" StringFormat="#,### €" />
                        </TextBlock.Text>
                    </TextBlock>
                    <OMANE_ui:NumericEditor x:Name="numericEditor1" Grid.Column="1" Style="{StaticResource PercentageEditor}" xml:lang="fr-FR" Format="#,### €" SpinIncrement="1000" Value="{Binding Path=CapitauxInitiaux}">
                        <OMANE_ui:NumericEditor.Visibility>
                            <Binding Path="IsCapitauxInitiauxValeurPerso">
                                <Binding.Converter>
                                    <BooleanToVisibilityConverter />
                                </Binding.Converter>
                            </Binding>
                        </OMANE_ui:NumericEditor.Visibility>

                    </OMANE_ui:NumericEditor>
   <StackPanel Grid.Row="1" Margin="40,10,0,0">
                        <RadioButton Margin="0,0,0,5" Content="Saisie Personnalisée" IsChecked="{Binding IsCapitauxInitiauxValeurPerso, Mode=TwoWay}" />
        				<RadioButton Margin="0,5,0,0" Content="Utiliser la base en entrée"/>
        			</StackPanel>
        		</Grid>
                <Grid Grid.Row="4" VerticalAlignment="Center" Margin="{DynamicResource ResultatItemMargin}">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="{DynamicResource LeftGridLength}"/>
        				<ColumnDefinition Width="{DynamicResource RightGridLength}"/>
        			</Grid.ColumnDefinitions>
        			
        			<TextBlock  Text="Croissance  du capital initial moyen" Margin="{DynamicResource InfoTextMargin}" VerticalAlignment="Center" />
        			<!-- <TextBlock   xml:lang="fr-FR" Text="{Binding ResultatsScenarioCentral.ChargementTech,  StringFormat=\{0:P\}}" Grid.Column="1" Margin="{DynamicResource InfoValueMargin}"/> !-->
        			<OMANE_ui:NumericEditor Grid.Column="1" Style="{StaticResource PercentageEditor}" Value="{Binding Path=CroissCapIni}"  />

        			
        		</Grid>
        	</Grid>
        </GroupBox>
        <Button Grid.Column="1" Margin="8" Grid.Row="3" Content="CALCULER LE SCENARIO CENTRAL" FontWeight="Bold" Command="{Binding CalculerScenarioCentralCommand, Mode=OneWay}">
            <Button.ToolTip>
                <ToolTip>
                    <TextBlock><Run Text="Lancer les calculs du scénario central du modèle 1"/></TextBlock>
                </ToolTip>
            </Button.ToolTip>
        </Button>
        <!--<Button Grid.Column="1" Margin="8" Grid.Row="4" FontWeight="Bold" Content="EFFECTUER LES SIMULATIONS" Command="{Binding EffectuerSimulationsCommand, Mode=OneWay}">
            <Button.ToolTip>
                <ToolTip>
                    <TextBlock><Run Text="Lancer les simulations du modèle 1. Nécessite que les calculs du scénario central aient été exécutés et soient à jour."/></TextBlock>
                </ToolTip>
            </Button.ToolTip>
        </Button>-->
        <Button Grid.Column="1" Margin="8" Grid.Row="4" Content="EXPORTER LES RESULTATS SOUS EXCEL" FontWeight="Bold" Command="{Binding ExporterVersExcelCommand, Mode=OneWay}">
            <Button.ToolTip>
                <ToolTip>
                    <TextBlock><Run Text="Exporter les résultats du scénario central sous Excel."/></TextBlock>
                </ToolTip>
            </Button.ToolTip>
        </Button>
    </Grid>
</UserControl>